#include <stdio.h>
#include <stdbool.h>
#include <windows.h>

void Print(int *arr, int size)
{
    for(int i = 0; i < size; i++)
    {
        printf("%d ", arr[i]);
    }
    printf("\n");
}

void shell_sort(int* arr, int size)
{
    int inc = 0;
    int i = 0;
    int j = 0;
    for(int inc = size / 2; inc > 0; inc /= 2)
    {

        for(int i = inc; i < size; i++)
        {
            int tmp = arr[i];
            for(j = i; j >= inc && arr[j - inc] > tmp; j -= inc)
            {
                arr[j] = arr[j - inc];
            }
            arr[j] = tmp;
        }
    }
}

int main()
{
    
    int arr[10] = {9,6,8,4,2,5,7,1,3,10};
    int size = sizeof(arr) / sizeof(arr[0]);
    shell_sort(arr, size);
    Print(arr, size);
    system("pause");
    return 0;
}